package net.lzzy.practicesapi1.entities;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author locker
 */
@Entity
@Getter
@Setter
public class Chapter extends BaseEntity{
    private String name;
    private String description;
    private boolean open;
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;

    @ManyToOne
    private Course course;
    @OneToMany(mappedBy = "chapter")
    private List<Question> questions = new ArrayList<>();

    public Chapter(){
        createTime = new Date();
        updateTime = createTime;
    }
}
